package com.oracle.moudle;

import com.oracle.common.TemplateMoudleMethod;
import com.oracle.service.IBoyService;
import com.oracle.vo.Girl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @program: CampusMatching
 * @description:
 * @author: zhaolei
 * @create: 2020-07-29 17:27
 **/
@Component
public class TemplateMoudleimp extends TemplateMoudleMethod {

    @Autowired
    IBoyService iBoyService;

    private Girl girl;

    private static TemplateMoudleimp templateMoudleimp;

    @PostConstruct
    public void init(){
        templateMoudleimp=this;
        templateMoudleimp.iBoyService=this.iBoyService;
    }

    public TemplateMoudleimp(Girl girl) {
        this.girl = girl;
    }

    @Override
    protected Boolean getObjByHobby() {
        System.out.println("根据爱好匹配");
        super.list=templateMoudleimp.iBoyService.getBoyByHobby(this.girl.getGhobby());
        if(!super.list.isEmpty()){
            return true;
        }else {
            return false;}
    }

    @Override
    protected Boolean getObjBySchool() {
        System.out.println("根据学校匹配");
        super.list=templateMoudleimp.iBoyService.getBoyBySchool(this.girl.getGschool());
        if(!super.list.isEmpty()){
            return true;
        }else {
            return false;}
    }

    @Override
    protected Boolean getObjByBirthday() {
        System.out.println("根据生日匹配");
        super.list=templateMoudleimp.iBoyService.getBoyByBirthday(this.girl.getGbirthday());
        if(!super.list.isEmpty()){
            return true;
        }else {
            return false;}
    }

    @Override
    protected Boolean getObjByself() {
        System.out.println("指定王一博进行匹配");
        super.list=templateMoudleimp.iBoyService.getslf();
        if(!super.list.isEmpty()){
            return true;
        }else {
            return false;}
    }
}
